import java.util.Scanner;

/**
 * 【程序14】  
 * 题目：输入某年某月某日，判断这一天是这一年的第几天？ 
 */
public class test14 {
    public static void main(String[] args) {
        int[] array1 = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
        int[] array2 = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
        int sum = 0;
        Scanner sc1 = new Scanner(System.in);
        System.out.print("请输入年份：");
        int year = sc1.nextInt();
        System.out.print("请输入月份：");
        int month = sc1.nextInt();
        System.out.print("请输入天数：");
        int day = sc1.nextInt();
        if ((year % 400 == 0) || ((year % 4 == 0) && (year % 100 != 0))) {
            switch (month) {
                case 1:
                    sum = day;
                    System.out.println("这一天是这一年的第" + sum + "天");
                    break;
                case 2:
                    sum = array1[0] + day;
                    System.out.println("这一天是这一年的第" + sum + "天");
                    break;
                case 3:
                    sum = array1[0] + array1[1] + day;
                    System.out.println("这一天是这一年的第" + sum + "天");
                    break;
                case 4:
                    sum = array1[0] + array1[1] + array1[2] + day;
                    System.out.println("这一天是这一年的第" + sum + "天");
                    break;
                case 5:
                    sum = array1[0] + array1[1] + array1[2] + array1[3] + day;
                    System.out.println("这一天是这一年的第" + sum + "天");
                    break;
                case 6:
                    sum = array1[0] + array1[1] + array1[2] + array1[3] + array1[4] + day;
                    System.out.println("这一天是这一年的第" + sum + "天");
                    break;
                case 7:
                    sum = array1[0] + array1[1] + array1[2] + array1[3] + array1[4] + array1[5] + array1[6] + day;
                    System.out.println("这一天是这一年的第" + sum + "天");
                    break;
                case 8:
                    sum = array1[0] + array1[1] + array1[2] + array1[3] + array1[4] + array1[5] + array1[6] + array1[7] + day;
                    System.out.println("这一天是这一年的第" + sum + "天");
                    break;
                case 9:
                    sum = array1[0] + array1[1] + array1[2] + array1[3] + array1[4] + array1[5] + array1[6] + array1[7] + array1[8] + day;
                    System.out.println("这一天是这一年的第" + sum + "天");
                    break;
                case 10:
                    sum = array1[0] + array1[1] + array1[2] + array1[3] + array1[4] + array1[5] + array1[6] + array1[7] + array1[8] + array1[9] + day;
                    System.out.println("这一天是这一年的第" + sum + "天");
                    break;
                case 11:
                    sum = array1[0] + array1[1] + array1[2] + array1[3] + array1[4] + array1[5] + array1[6] + array1[7] + array1[8] + array1[9] + array1[10] + day;
                    System.out.println("这一天是这一年的第" + sum + "天");
                    break;
                case 12:
                    sum = array1[0] + array1[1] + array1[2] + array1[3] + array1[4] + array1[5] + array1[6] + array1[7] + array1[8] + array1[9] + array1[10] + array1[11] + day;
                    System.out.println("这一天是这一年的第" + sum + "天");
                    break;
            }
        } else {
            switch (month) {
                case 1:
                    sum = day;
                    System.out.println("这一天是这一年的第" + sum + "天");
                    break;
                case 2:
                    sum = array2[0] + day;
                    System.out.println("这一天是这一年的第" + sum + "天");
                    break;
                case 3:
                    sum = array2[0] + array2[1] + day;
                    System.out.println("这一天是这一年的第" + sum + "天");
                    break;
                case 4:
                    sum = array2[0] + array2[1] + array2[2] + day;
                    System.out.println("这一天是这一年的第" + sum + "天");
                    break;
                case 5:
                    sum = array2[0] + array2[1] + array2[2] + array2[3] + day;
                    System.out.println("这一天是这一年的第" + sum + "天");
                    break;
                case 6:
                    sum = array2[0] + array2[1] + array2[2] + array2[3] + array2[4] + day;
                    System.out.println("这一天是这一年的第" + sum + "天");
                    break;
                case 7:
                    sum = array2[0] + array2[1] + array2[2] + array2[3] + array2[4] + array2[5] + array2[6] + day;
                    System.out.println("这一天是这一年的第" + sum + "天");
                    break;
                case 8:
                    sum = array2[0] + array2[1] + array2[2] + array2[3] + array2[4] + array2[5] + array2[6] + array2[7] + day;
                    System.out.println("这一天是这一年的第" + sum + "天");
                    break;
                case 9:
                    sum = array2[0] + array2[1] + array2[2] + array2[3] + array2[4] + array2[5] + array2[6] + array2[7] + array2[8] + day;
                    System.out.println("这一天是这一年的第" + sum + "天");
                    break;
                case 10:
                    sum = array2[0] + array2[1] + array2[2] + array2[3] + array2[4] + array2[5] + array2[6] + array2[7] + array2[8] + array2[9] + day;
                    System.out.println("这一天是这一年的第" + sum + "天");
                    break;
                case 11:
                    sum = array2[0] + array2[1] + array2[2] + array2[3] + array2[4] + array2[5] + array2[6] + array2[7] + array2[8] + array2[9] + array2[10] + day;
                    System.out.println("这一天是这一年的第" + sum + "天");
                    break;
                case 12:
                    sum = array2[0] + array2[1] + array2[2] + array2[3] + array2[4] + array2[5] + array2[6] + array2[7] + array2[8] + array2[9] + array2[10] + array2[11] + day;
                    System.out.println("这一天是这一年的第" + sum + "天");
                    break;
            }
        }
    }
}
